﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ZhiHeng.OneCard.CommUtility
{
    public class TranCode
    {
        /// <summary>
        /// 操作员签到
        /// </summary>
        public const string TRAN_CODE_OPER_SIGN = "@01";
        /// <summary>
        /// 操作员签退
        /// </summary>
        public const string TRAN_CODE_OPER_OUT = "@02";
        /// <summary>
        /// 激活
        /// </summary>
        public const string TRAN_CODE_CARD_ACTIVE = "@03";
        /// <summary>
        /// 休眠
        /// </summary>
        public const string TRAN_CODE_CARD_UNACTIVE = "@04";
        /// <summary>
        /// 联机存值
        /// </summary>
        public const string TRAN_CODE_LOAD = "@05";
        /// <summary>
        /// 退费
        /// </summary>
        public const string TRAN_CODE_REFUND = "@06";
        /// <summary>
        /// 联机消费
        /// </summary>
        public const string TRAN_CODE_ONLINE_CONSUME = "@07";
        /// <summary>
        /// 脱机消费
        /// </summary>
        public const string TRAN_CODE_OFFLINE_CONSUME = "@08";
        /// <summary>
        /// 挂失
        /// </summary>
        public const string TRAN_CODE_LOST = "@09";
        /// <summary>
        /// 解挂
        /// </summary>
        public const string TRAN_CODE_UNLOST = "@10";
        /// <summary>
        /// 冻结
        /// </summary>
        public const string TRAN_CODE_FREEZE = "@11";
        /// <summary>
        /// 解冻
        /// </summary>
        public const string TRAN_CODE_UNFREEZE = "@12";
        /// <summary>
        /// 锁定
        /// </summary>
        public const string TRAN_CODE_LOCK = "@13";
        /// <summary>
        /// 解除锁定
        /// </summary>
        public const string TRAN_CODE_UNLOCK = "@14";
        /// <summary>
        /// 取现
        /// </summary>
        public const string TRAN_CODE_TAKING = "@15";
        /// <summary>
        /// 网关签到
        /// </summary>
        public const string TRAN_CODE_GATEWAY_SIGN = "@16";
        /// <summary>
        /// 验证白名单
        /// </summary>
        public const string TRAN_CODE_CHECK_WL = "@17";
        /// <summary>
        /// 取白名单头
        /// </summary>
        public const string TRAN_CODE_GET_WL_HEAD = "@18";
        /// <summary>
        /// 取主白名单
        /// </summary>
        public const string TRAN_CODE_GET_MAIN_WL = "@19";
        /// <summary>
        /// 取小白名单
        /// </summary>
        public const string TRAN_CODE_GET_NEW_WL = "@20";
        /// <summary>
        /// 取黑名单头
        /// </summary>
        public const string TRAN_CODE_GET_BL_HEAD = "@21";
        /// <summary>
        /// 取主黑名单
        /// </summary>
        public const string TRAN_CODE_GET_MAIN_BL = "@22";
        /// <summary>
        /// 取小黑名单
        /// </summary>
        public const string TRAN_CODE_GET_NEW_BLACK = "@23";
        /// <summary>
        /// 开户注册
        /// </summary>
        public const string TRAN_CODE_ACC_OPEN = "@24";
        /// <summary>
        /// 退卡
        /// </summary>
        public const string TRAN_CODE_ACC_CLOSE = "@25";
        /// <summary>
        /// 换卡
        /// </summary>
        public const string TRAN_CODE_CARD_CHANGE = "@26";
        /// <summary>
        /// 子系统签到
        /// </summary>
        public const string TRAN_CODE_SUBSYS_SIGN = "@27";
        /// <summary>
        /// 获取最大流水号
        /// </summary>
        public const string TRAN_CODE_GET_MAXJNL = "@28";
        /// <summary>
        /// 收取卡押金
        /// </summary>
        public const string TRAN_CODE_DEPOSIT = "@29";
        /// <summary>
        /// 退还卡押金
        /// </summary>
        public const string TRAN_CODE_UNDEPOSIT = "@30";
        /// <summary>
        /// 收取设备押金
        /// </summary>
        public const string TRAN_CODE_RENT= "@31";
        /// <summary>
        /// 退还设备押金
        /// </summary>
        public const string TRAN_CODE_UNRENT = "@32";
        /// <summary>
        /// 联机VIP卡存值
        /// </summary>
        public const string TRAN_CODE_VIP_LOAD = "@33";
        /// <summary>
        /// 联机VIP卡注册
        /// </summary>
        public const string TRAN_CODE_VIP_OPEN = "@34";
        /// <summary>
        /// 联机VIP卡取现
        /// </summary>
        public const string TRAN_CODE_VIP_TAKING = "@35";
        /// <summary>
        /// 商户清算
        /// </summary>
        public const string TRAN_CODE_MERC_QS = "@36";
        /// <summary>
        /// 平账请求
        /// </summary>
        public const string TRAN_CODE_BALANCE_REQUEST = "@37";
        /// <summary>
        /// 平账流水
        /// </summary>
        public const string TRAN_CODE_BALANCE_TRJN = "@38";
        /// <summary>
        /// 平账冲正
        /// </summary>
        public const string TRAN_CODE_BALANCE_REVERSE = "@39";
        /// <summary>
        /// 冲正/取消
        /// </summary>
        public const string TRAN_CODE_REVERSE = "@40";
        /// <summary>
        /// 现金领用
        /// </summary>
        public const string TRAN_CODE_CASH_OUT = "@41";
        /// <summary>
        /// 现金交存
        /// </summary>
        public const string TRAN_CODE_CASH_IN = "@42";
        /// <summary>
        /// 手工调账
        /// </summary>
        public const string TRAN_CODE_MANUAL_TRAN = "@43";
        /// <summary>
        /// 校正卡片
        /// </summary>
        public const string TRAN_CODE_CARD_ADJUST = "@44";
        /// <summary>
        /// 脱机退卡
        /// </summary>
        public const string TRAN_CODE_ACC_OFFLINE_CLOSE = "@45";
    }

    public class RetCode
    {
        /// <summary>
        /// 成功
        /// </summary>
        public const short RET_CODE_OK = 0;
        /// <summary>
        /// 流水号重复
        /// </summary>
        public const short RET_CODE_TRJN_REUSE = 1;
        /// <summary>
        /// 通讯包错误
        /// </summary>
        public const short RET_CODE_BAG_ERROR = 2;
        /// <summary>
        /// 版本不符
        /// </summary>
        public const short RET_CODE_VER_ERROR = 3;
        /// <summary>
        /// 操作失败
        /// </summary>
        public const short RET_CODE_ACTION_FAILED = 4;
        /// <summary>
        /// 账号不存在
        /// </summary>
        public const short RET_CODE_CARD_NOEXSIT = 100;
        /// <summary>
        /// IP地址不存在
        /// </summary>
        public const short RET_CODE_IP_NOEXSIT = 101;
        /// <summary>
        /// 钱包余额不足
        /// </summary>
        public const short RET_CODE_NON_AMT = 102;
        /// <summary>
        /// 对方帐户余额不足不能进行反操作交易
        /// </summary>
        public const short RET_CODE_THIRD_NON_AMT = 103;
        /// <summary>
        /// 该卡已解冻
        /// </summary>
        public const short RET_CODE_UNFREEZED = 104;
        /// <summary>
        /// 该卡已冻结
        /// </summary>
        public const short RET_CODE_FREEZED = 105;
        /// <summary>
        /// 自动冻结不能解冻，请先平帐！
        /// </summary>
        public const short RET_CODE_AUTO_FREEZED = 106;
        /// <summary>
        /// 密码错误
        /// </summary>
        public const short RET_CODE_PWD_ERROR = 107;
        /// <summary>
        /// 密码认证失败
        /// </summary>
        public const short RET_CODE_PWD_AUTH_FAILED = 108;
        /// <summary>
        /// 卡已解挂
        /// </summary>
        public const short RET_CODE_UNLOSTED = 109;
        /// <summary>
        /// 卡已挂失
        /// </summary>
        public const short RET_CODE_LOSTED = 110;
        /// <summary>
        /// 卡已锁定
        /// </summary>
        public const short RET_CODE_LOCKED = 111;
        /// <summary>
        /// 卡已解锁
        /// </summary>
        public const short RET_CODE_UNLOCKED = 112;
        /// <summary>
        /// 卡已激活
        /// </summary>
        public const short RET_CODE_ACTIVED = 113;
        /// <summary>
        /// 卡已休眠
        /// </summary>
        public const short RET_CODE_UNACTIVED = 114;
        /// <summary>
        /// 卡已销户
        /// </summary>
        public const short RET_CODE_ACC_CLOSED = 115;
        /// <summary>
        /// 卡已存在
        /// </summary>
        public const short RET_CODE_EXSITED = 116;
        /// <summary>
        /// 交易代码不正确
        /// </summary>
        public const short RET_CODE_ERRORCODE = 117;
        /// <summary>
        /// 交易金额不正确
        /// </summary>
        public const short RET_CODE_ERRORAMT = 118;
        /// <summary>
        /// 商户账号不存在
        /// </summary>
        public const short RET_CODE_NON_MERCACC = 119;
        /// <summary>
        /// 押金不足
        /// </summary>
        public const short RET_CODE_NON_DEPOSIT = 120;
        /// <summary>
        /// 库余额不为零，不允许重新发卡
        /// </summary>
        public const short RET_CODE_EBAGAMT_NON_ZERO = 121;
        /// <summary>
        /// 商户余额不足
        /// </summary>
        public const short RET_CODE_MERC_NON_AMT = 122;
        /// <summary>
        /// 系统未开工
        /// </summary>
        public const short RET_CODE_SYS_NO_WORK = 123;
        /// <summary>
        /// 系统正在日结中
        /// </summary>
        public const short RET_CODE_SYS_DALIYING = 124;
        /// <summary>
        /// 无需日结
        /// </summary>
        public const short RET_CODE_ALREADY_DALIY = 125;
        /// <summary>
        /// 商户账号或科目不存在
        /// </summary>
        public const short RET_CODE_NON_SUBJECT = 126;
        /// <summary>
        /// 账户余额不足
        /// </summary>
        public const short RET_CODE_EAMT_NEGATIVE = 127;
        /// <summary>
        /// 卡号账号不符
        /// </summary>
        public const short RET_CODE_ERR_CARD_ACCOUNT = 128;
    }

    public enum CardActionType
    {
        Lost,//挂失
        UnLost,//解挂
        Freeze,//冻结
        UnFreeze,//解冻
        Lock,//锁定
        UnLock,//解锁
        Active,//激活
        UnActive,//休眠
        Send,//发卡
        Close//退卡
    }

    public enum CardType :byte
    {
        门票卡 = 0x01,
        会员计次卡 = 0x02,
        消费卡 = 0x11,
        游客卡 = 0x12,
        会员计费卡 = 0x13,
        员工卡 = 0x21,
        VIP卡 =  0x30
    }

    public enum Sex : byte
    {
        未知 =0,
        男 =1,
        女 =2
    }
}
